// @ts-nocheck
import FormTabbarPreview from './FormTabbarPreview.vue';
import FormTabbarSetting from './FormTabbarSetting.vue';
/* util */
import { getSetting } from '@src/mform/util'
/* vue */
import Vue from 'vue';

let FormTabbarField = {
  formType: 'tabbar', // 字段类型
  name: '底部导航栏',
  isSystem: 0,
  // number: 10,
  // icon: 'icon-notification-fill',
  forceDelete: false,
  component: {
    setting: FormTabbarSetting,
    preview: FormTabbarPreview,
  },
  packFunction: pack,
  unPackFunction: unpack,
  validateFunction: validate,
};

export function unpack(field)  {
  let setting = getSetting(field.setting)

  let settingValue = {
    list: setting.list || []
  }

  Vue.set(field, 'setting', Object.assign(setting, settingValue))
}

export function pack(field) {
  let originSetting = getSetting(field.setting)
  
  const setting = {
    list: originSetting?.list || [],
  }
  
  Vue.set(field, 'setting', setting)
}

export function validate(field) {

}

export default FormTabbarField;
